import { http } from "@/utils/http";
import { baseUrlApi } from "@/api/utils";
import { Result, ResultTable } from "@/api/types";

/** 获取系统管理-角色管理列表 */
export const getRoleList = (data?: object) => {
  return http.request<ResultTable>("post", baseUrlApi("roles"), { data });
};

/** 系统管理保存-新增角色 */
export const saveRole = (data?: object) => {
 
  return http.request<ResultTable>("post", baseUrlApi("saveRole"), { data });
};
/**更新系统管理-角色 */
export const updateRole = (data?: object) => {

  return http.request<ResultTable>("put", baseUrlApi("roles"), { data });
};
/**删除系统管理-角色 */
export const deleteRole = (data?: object) => {
 
  return http.request<ResultTable>("delete", baseUrlApi("roles"), { data });
};
/**更新系统管理-指定用户 */
export const updateRoleStatus = (data?: object) => {
  
  return http.request<ResultTable>("post", baseUrlApi("updateRoleStatus"), { data });
};
/** 获取角色管理-权限-菜单权限 */
export const getRoleMenu = (data?: object) => {
  return http.request<Result>("post", baseUrlApi("roleMenu"), { data });
};

/** 获取角色管理-权限-菜单权限-根据角色 id 查对应菜单 */
export const getRoleMenuIds = (data?: object) => {
  return http.request<Result>("post", baseUrlApi("getRoleMenuIdsById"), { data });
};
/** 获取角色管理-权限-菜单权限-保存对应菜单 */
export const saveRoleMenu = (data?: object) => {
  return http.request<Result>("post", baseUrlApi("saveRoleMenu"), { data });
};